package fr.lelouet.tests.rmi;

import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;

import fr.lelouet.tests.rmi.impl.ControlerImpl;

public class LaunchServer {

	static final int RMIPORT = 1033;
	static final String RMINAME = "lol";

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			ControlerImpl c = new ControlerImpl();
			Registry reg = LocateRegistry.createRegistry(RMIPORT);
			Remote remote = UnicastRemoteObject.exportObject(c, 0);
			reg.rebind(RMINAME, remote);
			c.waitForAction();
			c.send("answer");
		} catch (RemoteException e) {
			e.printStackTrace(System.err);
		}
	}
}
